'use strict';

const Controller = require('egg').Controller;

function toInt(str) {
  if (typeof str === 'number') return str;
  if (!str) return str;
  return parseInt(str, 10) || 0;
}
class AdminController extends Controller {
  async currentUser() {
    const ctx = this.ctx;
    // const token = ctx.request.header.dauthorization;
    // const { id } = ctx.session.userInfo.user;
    // if (ctx.session.admin_token === token) {
    const user = await ctx.model.User.findByPk(toInt(1));
    ctx.body = { code: 0, data: { user }, message: 'success' };
    // }
  }

}

module.exports = AdminController;
